import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2025-09-23
 * Time: 10:37
 */
public class demo2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt(), e = sc.nextInt();
        int ret = 0;

        for(int i = s; i <= e; i++){
            int tmp = i;
            while(tmp != 0){
                if(tmp % 10 == 2) ret++;
                tmp /= 10;
            }
        }
        System.out.println(ret);
    }
}
